package com.appkubes.mall.restful.application.activity.goods.dao;

import com.appkubes.mall.restful.application.activity.goods.entity.dto.DdqListDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.joda.time.DateTime;

import java.util.Date;
import java.util.List;

/**
 * @Author: Lin Jiaming
 * @Date: 2020/3/7 11:17
 * @Description:
 */
@Mapper
public interface ActivityGoodsDao {

    @Select("SELECT activity_goods.activity_goods_key,activity_goods.activity_key,goods.goods_key,goods.goods_id,goods.item_link,goods.title,\n" +
            "goods.dtitle,goods.promotion_text,goods.actual_price,goods.commission_rate,goods.coupon_price,goods.coupon_link\n" +
            "FROM mall_activity_goods AS activity_goods \n" +
            "LEFT JOIN mall_activity AS activity ON activity_goods.activity_key=activity.activity_key\n" +
            "LEFT JOIN mall_goods_taobao AS goods ON activity_goods.goods_key=goods.goods_key\n" +
            "WHERE activity.start_time>='${startTime}'\n" +
            "AND activity.start_time<='${endTime}'")
    List<DdqListDTO> DdqList(Page page, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
}
